﻿
@section Script
{
    <link href="~/Content/mvcpage/jquery.mvcpage.css" rel="stylesheet" />
    <script src="~/Content/mvcpage/jquery.mvcpage.js"></script>
    <link href="~/Content/window/window.css" rel="stylesheet" />
    <script src="~/Content/window/window.js"></script>


    <script type="text/javascript">
        $(function () {
            $(".pagectrl").mvcPage({
                url: '/Bonus/IndexPage',
                callBack: function (html) {
                    $(".list").html(html);
                }
            });
        });

        function search() {
            $(".pagectrl").mvcPage('option').queryParam.keyword = $('#keyword').val();
            $(".pagectrl").mvcPage('reload');
        }

        function SettlementState(id,state) {
            window.messageBox("系统提示", "确认结算吗?", function (r) {
                if (!r) return;
                if (state != "未结算") {
                    window.messageBox("系统提示", "状态错误，不能结算");
                    return;
                }
                $.post("/Bonus/SettlementState?id=" + id, $('form').serialize(), function (data) {
                    if (data.state) {
                        $(".pagectrl").mvcPage('reload');
                    } else {
                        window.messageBox('提示', data.value);
                    }
                });
            });
        }

        function SettlementGrant(id, state) {
            window.messageBox("系统提示", "确认发放吗?", function (r) {
                if (!r) return;
                if (state != "已结算") {
                    window.messageBox("系统提示", "状态错误，不能发放");
                    return;
                }
                $.post("/Bonus/SettlementGrant?id=" + id, $('form').serialize(), function (data) {
                    if (data.state) {
                        $(".pagectrl").mvcPage('reload');
                    } else {
                        window.messageBox('提示', data.value);
                    }
                });
            });
        } 

        function BonusDel(id) {
            window.messageBox("系统提示", "确认删除吗?", function (r) {
                if (!r) return;
                $.post("/Bonus/BonusDel?id=" + id, $('form').serialize(), function (data) {
                    if (data.state) {
                        $(".pagectrl").mvcPage('reload');
                    } else {
                        window.messageBox('提示', data.value);
                    }
                });
            });
        } BonusDel
    </script>
}
<div>
    <ul class="breadcrumb">
        <li><a href="/user/activate">奖金管理</a> <span class="divider">/</span></li>
        <li class="active">奖金管理</li>
    </ul>
</div>


<!--查询-->
<div class="toolbar">

    <div class="left-block">
        <input id="keyword" type="text" placeholder="关键字...">
        <button class="btn dropdown-toggle " type="button" onclick="search(); return false;" style="vertical-align: top;"><i class="icon-search"></i>查询</button>
    </div>
</div>

<table class="table table-bordered">
    <thead>
        <tr>
            <td>序号</td>
            <td>期数</td>
            <td>开始日期</td>
            <td>结束日期</td>
            <td>状态</td>
            <td>结算类型</td>
            <td>结算人</td>
            <td>操作</td>
        </tr>
    </thead>
    <tbody class="list">
    </tbody>
</table>
<div class="text-right pagectrl"></div>
